<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>生产登记</title>
    <!-- Google Font: Source Sans Pro -->
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="../plugins/fontawesome-free/css/all.min.css">
    <!-- Theme style -->
    <link rel="stylesheet" href="../dist/css/adminlte.min.css">
    <!-- overlayScrollbars -->
    <link rel="stylesheet" href="../plugins/overlayScrollbars/css/OverlayScrollbars.min.css">
</head>
<body onload="Productionregistrationreview()">
    <link rel="stylesheet"  href="../css/bootstrap.min.css">
    <link rel="stylesheet"  href="../css/bootstrap-table.min.css">
    <script src="../js/jquery.min.js" ></script>
    <script src="../js/bootstrap.bundle.min.js" ></script>
    <script src="../js/bootstrap.min.js"  ></script>
    <script src="../js/bootstrap-table.min.js"  ></script>
    <script src="../js/bootstrap-table-zh-CN.min.js"></script>
    <script src="../js/index.js"></script>
<table id="tab">
    <tr>
        <th>工序编号</th>
        <th>工序名称</th>
        <th>描述</th>
        <th>工时数</th>
        <th>单位工时成本</th>
        <th>工时完成小计</th>
        <th>工序登记</th>
        <th></th>
    </tr>
</table>
    <div class="modal" tabindex="-1" role="dialog" id="show">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <!--<h5 class="modal-title"></h5>-->
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <p>生产数量</p>
                    投产数量：<span id="sp1"></span>
                    合格数量： <input type="number" id="num">
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
                    <button type="button" class="btn btn-primary" onclick="subm()">提交</button>
                </div>
            </div>
        </div>
    </div>

    <script>
        function f(){
            $.post("../scdj/queryr",function (date) {
                var table=$("#tab")
                var a=""
                var b=""
                $(date.list).each(function (index,item) {
                    if (item.manufactureProcedureTag=="G004-3") {
                        a = "交接登记"
                        b="完成"

                    }
                    if(item.manufactureProcedureTag=="G004-0"){
                        b = "<button class='btn-outline-dark btn' onclick='ck()'>登记</button>"
                    }
                    if (item.manufactureProcedureTag=="G004-1"){
                        b="待审核"
                    }
                    if (item.manufactureProcedureTag=="G004-2"){
                        b="完成"
                    }
                    var tr=$("<tr><td>"+item.id+"</td><td>"+item.procedureName+"</td>" +
                        "<td>"+item.register+"</td><td>"+item.labourHourAmount+"</td>" +
                        "<td>"+item.subtotal+"</td><td>"+b+"</td>" +
                        "<ta><a onclick='cks("+item.realAmount+","+item.demandAmount+")'>"+a+"</a></ta></tr>");
                    table.append(tr);
                })
            },"json")
        }
        function subm() {
            $.post("../scdj/updatenum",{"realAmount":$("#num").val(),"parentId":$("#id").val(),"procedureFinishTag":"G004-3"},function () {

            })
        }
        function ck(){
            location.href="queryfhdj.html";
        }
        function cks(id,num){
            $("#sp1").val(num);
            $("#num").val()
            $("#show").show()
        }
    </script>
</body>
</html>